package com.wave.wavesystem.common.util;


import com.wave.wavesystem.business.pojo.entity.UserEntity;
import com.wave.wavesystem.common.constant.RequestConstant;

/**
 * @author 夕下风波
 * @date 2025-02-03 12:05
 * @description 权限工具列
 */
public class AuthUtil {

    /**
     * 获取当前登录用户
     */
    public static UserEntity getUser() {
        Object currentUser = WebUtil.getRequest().getSession().getAttribute(RequestConstant.USER_INFO);
        if (Func.isEmpty(currentUser)) {
            return null;
        }
        return (UserEntity) currentUser;
    }

    /**
     * 判断当前 是否存在用户
     */
    public static boolean existsUser() {
        UserEntity user = (UserEntity) WebUtil.getRequest().getSession().getAttribute(RequestConstant.USER_INFO);
        return Func.isNotEmpty(user);
    }

}
